﻿public class Line
{
	private Point endPoint;
	private Point startPoint;
	
	public Point getEndPoint()
	{
		return endPoint;
	}

	public void setEndPoint(Point newEndPoint)
	{
		endPoint = newEndPoint;
	}

	public Point getStartPoint()
	{
		return startPoint;
	}

	public void setStartPoint(Point newStartPoint)
	{
		startPoint = newStartPoint;
	}

	/**
	 * 根据给定起点和终点或随机画线。
	 */
	public Line drawLine(Point startPoint, Point endPoint)
	{
		Point point = new Point();
		if (startPoint == null)
		{
			startPoint = point.drawPoint();
			setStartPoint(startPoint);
		} else
		{
			setStartPoint(startPoint);
		}
		if (endPoint == null)
		{
			endPoint = point.drawPoint();
			setEndPoint(endPoint);
		} else
		{
			setEndPoint(endPoint);
		}
		return null;
		/*
		 *   
		 *   Point epoint = new Point();
		 *   epoint.drawPoint();
		 *   if (startPoint == null) {
		 *   startPoint = epoint;
		 *   }
		 *   setStartPoint(startPoint);
		 *   if (endPoint == null) {
		 *   endPoint =epoint;
		 *   }
		 *   setEndPoint(endPoint);
		 */
	}
}